<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="signupForm">
                        <input id="id" name="id" th:value="${productInner.id}" type="hidden">
                        <div class="form-group">
                            <!--<label class="col-sm-3 control-label">产品id：</label>-->
                            <div class="col-sm-8">
                                <input id="productId" name="productId" th:value="${productInner.productId}"
                                       class="form-control" type="hidden">
                            </div>
                        </div>
                        <div class="form-group">

                            <div class="col-sm-8">
                                <input id="projectId" name="projectId" th:value="${productInner.projectId}"
                                       class="form-control" type="hidden">
                            </div>
                        </div>
                        <!--<div class="form-group">	-->
                        <!--<label class="col-sm-3 control-label">是产品吗：</label>-->
                        <!--<div class="col-sm-8">-->
                        <!--<input id="isProduct" name="isProduct" th:value="${productInner.isProduct}" class="form-control" type="text">-->
                        <!--</div>-->
                        <!--</div>-->
                        <input id="sonsysId" name="sonsysId" th:value="${productInner.sonsysId}"
                               class="form-control" type="hidden">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">报价：</label>
                            <div class="col-sm-5">
                                <input id="baojia" style="width: 300px" name="baojia" th:value="${productInner.baojia}" class="form-control"
                                       type="number" readonly>
                            </div>
                            <div class="col-sm-4">报价 = （人工 + 机器 + 材料 ） * 2   ，如需修改，请点击产品管理</div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">折扣：</label>
                            <div class="col-sm-8">
                                <input id="zhekou" name="zhekou" th:value="${productInner.zhekou}"
                                       class="form-control" type="number" placeholder="输入0.00 - 1.00的折扣小数">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">实际报价（报价*折扣）：</label>
                            <div class="col-sm-4">
                                <input id="shijibaojia" readonly style="width: 240px;" name="shijibaojia" th:value="${productInner.shijibaojia}" class="form-control" type="number">

                            </div>
                            <div class="col-sm-5"><button id="calshijibaojia" click="calshijibaojia()" type="button" class="btn btn-success btn-sm ">计算一下实际报价</button></div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">数量：</label>
                            <div class="col-sm-8 input-group spinner">
                                <input id="proNum" name="proNum" class="form-control" type="number" th:value="${productInner.proNum}">
                                <div class="input-group-btn-vertical" style="margin-left: 15px;">
                                    <button class="btn btn-default" type="button"><i class="fa fa-caret-up"></i>
                                    </button>
                                    <button class="btn btn-default" type="button"><i class="fa fa-caret-down"></i>
                                    </button>
                                </div>
                            </div>

                        </div>


                        <div class="form-group">
                            <label class="col-sm-3 control-label">备注：</label>
                            <div class="col-sm-8">
                                <input id="beizhu" name="beizhu" th:value="${productInner.beizhu}" class="form-control"
                                       type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">子系统排序：</label>
                            <div class="col-sm-8">
                                <input id="orderId" name="orderId" th:value="${productInner.orderId}"
                                       class="form-control"
                                       type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button type="submit" class="btn btn-primary">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/js/appjs/system/productInner/edit.js">
</script>

<script type="text/javascript">



    $(function () {
        var baojia = $("#baojia").val();
        $("#baojia").val(formatnum(baojia));

        var shijibaojia = $("#shijibaojia").val();
        $("#shijibaojia").val(formatnum(shijibaojia));



    })



    function formatnum(num) {

        return new Number(num);
    }

    $(function () {
        $("#calshijibaojia").click(function () {
            var baojia = $("#baojia").val();
            var zhekou = $("#zhekou").val();
            $("#shijibaojia").val(cheng(baojia,zhekou));
        });
    });
    function cheng(arg1, arg2){
        var m=0,s1=arg1.toString(),s2=arg2.toString();
        try{m+=s1.split(".")[1].length}catch(e){}
        try{m+=s2.split(".")[1].length}catch(e){}
        return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
    }

    function calshijibaojia() {
        alert();
        var zhekou = $("#zhekou").val();
        var baojia = $("#baojia").val();
        $("#shijibaojia").val(zhekou*baojia);
    }

    function catclick(catId, catName) {
        $("#dropdownMenu1").text(catName);
        $("#sonsysId").val(catId);

    }

    $(function () {
        $('.spinner .btn:first-of-type').on('click', function() {
            $('.spinner input').val( parseInt($('.spinner input').val(), 10) + 1);
        });
        $('.spinner .btn:last-of-type').on('click', function() {
            $('.spinner input').val( parseInt($('.spinner input').val(), 10) - 1);
        });
    });

</script>
</body>
<style>

    .spinner {
        width: 100px;
    }
    .spinner input {
        text-align: right;
        margin-left: 15px;
    }
    .input-group-btn-vertical {
        position: relative;
        white-space: nowrap;
        width: 2%;
        vertical-align: middle;
        display: table-cell;
        margin-left: 15px;
    }
    .input-group-btn-vertical > .btn {
        display: block;
        float: none;
        width: 100%;
        max-width: 100%;
        padding: 8px;
        margin-left: 15px;
        position: relative;
        border-radius: 0;
    }
    .input-group-btn-vertical > .btn:first-child {
        border-top-right-radius: 4px;
    }
    .input-group-btn-vertical > .btn:last-child {
        margin-top: -2px;
        border-bottom-right-radius: 4px;
    }
    .input-group-btn-vertical i{
        position: absolute;
        top: 0;
        left: 4px;
    }
</style>
</html>
